<?php /**
 * myZipArchive
 * @author tuadmin
 * @copyright tuadmin
 * @version 1.2
 * @access public
 */
 class myZipArchive extends ZipArchive { public function addFolder($a, $b = false) { $c = $b ? dirname($a) :$a; $c = strlen($c); $d = $a; $e = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($a)); foreach($e as $f) { $g = strtr($f->getpathname(),DIRECTORY_SEPARATOR,'/'); $this->addFile($f->getpathname(),ltrim(substr($g,$c),'/') ); } } public function addFolderIn($h,$i,$b = false) { $i = trim($i,'/'); $c = $b ? dirname($h) :$h; $c = strlen($c); $d = $h; $e = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($h)); foreach($e as $f) { $g = strtr($f->getpathname(),DIRECTORY_SEPARATOR,'/'); $this->addFile($f->getpathname(),$i . '/' . ltrim(substr($g,$c),'/') ); } } }